home *** CD-ROM | disk | FTP | other *** search
- on EndGame
- global gcTRBAL_CH1, gcTRPLYR1SCORECH, gcTRPLYR2SCORECH, gzTRPlayerObj, gTRGameObj, gcTRSCOREBRD_CH, gcTRROVER, gTREndGame, gTREndThisGame
- set vP1High to 0
- set vP2High to 0
- set vP1BeatHigh to 0
- set vP2BeatHigh to 0
- if not gTREndGame then
- KillAllBalloons()
- end if
- set the trails of sprite gcTRROVER to 0
- set the visible of sprite gcTRROVER to 1
- set the locH of sprite gcTRROVER to 318
- set the locV of sprite gcTRROVER to 208
- GetPlayersNames()
- set vTheWinner to GetWinner()
- set vPlayerOne to mGetMyName(getAt(gzTRPlayerObj, 1))
- set vP1Score to mGetMyCurrentScore(getAt(gzTRPlayerObj, 1))
- set vP1High to mGetMyHighestScore(getAt(gzTRPlayerObj, 1))
- if vP1Score > vP1High then
- mSetMyHighestScore(getAt(gzTRPlayerObj, 1), vP1Score)
- set vP1BeatHigh to 1
- end if
- set vPlayMode to mGetPlayMode(gTRGameObj)
- if vPlayMode = 1 then
- if not gTREndGame then
- GetPlayersNames()
- StartNewGame()
- return
- else
- if vP1BeatHigh then
- ShowLoginScreens(vP1BeatHigh, 0, 1)
- else
- go("StopGame")
- end if
- end if
- end if
- if vPlayMode = 2 then
- set vP2Score to mGetMyCurrentScore(getAt(gzTRPlayerObj, 2))
- set vP2High to mGetMyHighestScore(getAt(gzTRPlayerObj, 2))
- if vP2Score > vP2High then
- mSetMyHighestScore(getAt(gzTRPlayerObj, 2), vP2Score)
- set vP2BeatHigh to 1
- end if
- ShowTheWinner(vTheWinner)
- if gTREndThisGame then
- ShowLoginScreens(vP1BeatHigh, vP2BeatHigh, vTheWinner)
- set gTREndThisGame to 0
- else
- set the visible of sprite 45 to 0
- updateStage()
- if not gTREndGame then
- GetPlayersNames()
- StartNewGame()
- end if
- return
- end if
- end if
- end
-
- on ShowLoginScreens vP1BeatHigh, vP2BeatHigh, vTheWinner
- global gTREndGame, gzTRPlayerObj
- if vP1BeatHigh and vP2BeatHigh then
- updateStage()
- go("TwoHighScores")
- else
- if vP1BeatHigh and (vTheWinner = 1) then
- updateStage()
- go("P1HighScore")
- else
- if vP2BeatHigh and (vTheWinner = 2) then
- updateStage()
- go("P2HighScore")
- end if
- end if
- end if
- end
-
- on EnterNewChamps
- global gSIUserName, gzTRPlayerObj, gzTRPersBestScores, gTRGameObj, gzTRAllTimeHighs
- GetPlayersNames()
- set vPlayerOne to mGetMyName(getAt(gzTRPlayerObj, 1))
- set vPlayerTwo to mGetMyName(getAt(gzTRPlayerObj, 2))
- set vP1BeatHigh to mGetBeatHighScore(getAt(gzTRPlayerObj, 1))
- set vP2BeatHigh to mGetBeatHighScore(getAt(gzTRPlayerObj, 2))
- set vP1Score to mGetMyCurrentScore(getAt(gzTRPlayerObj, 1))
- set vP2Score to mGetMyCurrentScore(getAt(gzTRPlayerObj, 2))
- addProp(gzTRAllTimeHighs, vPlayerOne, value(vP1Score))
- if vP1BeatHigh and (vPlayerOne = gSIUserName) then
- add(gzTRPersBestScores, vP1Score)
- end if
- set vPlayMode to mGetPlayMode(gTRGameObj)
- addProp(gzTRAllTimeHighs, vPlayerTwo, value(vP2Score))
- if vPlayMode = 2 then
- if vP2BeatHigh and (vPlayerTwo = gSIUserName) then
- add(gzTRPersBestScores, vP2Score)
- end if
- end if
- MakeChampList()
- MakePersBestList()
- end
-
- on GetPlayersNames
- global gzTRPlayerObj
- set vPlayerOne to the text of field "P1LogIn"
- set vPlayerTwo to the text of field "P2LogIn"
- mSetMyName(getAt(gzTRPlayerObj, 1), vPlayerOne)
- mSetMyName(getAt(gzTRPlayerObj, 2), vPlayerTwo)
- end
-
- on MakeChampList
- global gzTRAllTimeHighs
- set vFinalListLeft to EMPTY
- set vFinalListRight to EMPTY
- set the text of cast "ChampionListATBleft" to " "
- set the text of cast "ChampionListATBright" to " "
- set vSortedList to [:]
- set vSortedList to SortListDescending()
- repeat with vI = 1 to count(vSortedList)
- set vName to vI & ". " & getPropAt(vSortedList, vI)
- set vScore to getAt(vSortedList, vI)
- if vI < 6 then
- set vFinalListLeft to vFinalListLeft & " " & vName & " " & vScore & RETURN
- next repeat
- end if
- if vI > 5 then
- set vFinalListRight to vFinalListRight & " " & vName & " " & vScore & RETURN
- end if
- end repeat
- set the text of cast "ChampionListATBleft" to vFinalListLeft
- set the text of cast "ChampionListATBright" to vFinalListRight
- SetChampsAttribs()
- end
-
- on SortListDescending
- global gzTRAllTimeHighs
- set vMaxChamps to 10
- set vCount to 0
- set vSortedList to [:]
- set vTempList to [:]
- set vTempList to value(string(gzTRAllTimeHighs))
- repeat while (count(vTempList) > 0) and (vCount < vMaxChamps)
- set vBig to max(vTempList)
- set vName to getOne(vTempList, vBig)
- set vPos to getPos(vTempList, vBig)
- set vScore to vBig
- addProp(vSortedList, vName, vScore)
- deleteAt(vTempList, vPos)
- set vCount to vCount + 1
- end repeat
- return vSortedList
- end
-
- on MakePersBestList
- global gSIUserName, gzTRPersBestScores, startMovie, gzTRPlayerObj
- set vPlayerOne to mGetMyName(getAt(gzTRPlayerObj, 1))
- set vPlayerTwo to mGetMyName(getAt(gzTRPlayerObj, 2))
- if (gSIUserName <> vPlayerOne) and (gSIUserName <> vPlayerTwo) then
- return
- end if
- set vFinalListLeft to EMPTY
- set vFinalListRight to EMPTY
- set the text of cast "PersonalBestLeft" to " "
- set the text of cast "PersonalBestright" to " "
- SetChampsAttribs()
- set vTemp to list()
- set vTemp to value(string(gzTRPersBestScores))
- sort(vTemp)
- set gzTRPersBestScores to list()
- set vCount to 1
- repeat with vI = count(vTemp) down to 1
- add(gzTRPersBestScores, getAt(vTemp, vI))
- set vCount to vCount + 1
- if vCount > 10 then
- exit repeat
- end if
- end repeat
- repeat with vI = 1 to count(gzTRPersBestScores)
- set vName to vI & ". " & gSIUserName
- set vScore to getAt(gzTRPersBestScores, vI)
- if vI < 6 then
- set vFinalListLeft to vFinalListLeft & " " & vName & " " & vScore & RETURN
- next repeat
- end if
- if vI > 5 then
- set vFinalListRight to vFinalListRight & " " & vName & " " & vScore & RETURN
- end if
- end repeat
- set the text of cast "PersonalBestLeft" to vFinalListLeft
- set the text of cast "PersonalBestRight" to vFinalListRight
- SetChampsAttribs()
- end
-
- on GetWinner
- global gzTRPlayerObj, gTRGameObj
- set vPlayMode to mGetPlayMode(gTRGameObj)
- if vPlayMode = 1 then
- return 1
- end if
- set p1Score to mGetMyCurrentScore(getAt(gzTRPlayerObj, 1))
- set p2Score to mGetMyCurrentScore(getAt(gzTRPlayerObj, 2))
- if p1Score > p2Score then
- set vTheWinner to 1
- end if
- if p2Score > p1Score then
- set vTheWinner to 2
- end if
- if p1Score = p2Score then
- set vTheWinner to 0
- end if
- return vTheWinner
- end
-
- on ShowTheWinner aTheWinner
- global gcTRROVER, gTRWinnerFrameRelease
- set gTRWinnerFrameRelease to 0
- go("ShowWinner")
- if aTheWinner = 1 then
- set the castNum of sprite gcTRROVER to the number of cast "Player1Wins"
- updateStage()
- updateStage()
- repeat while soundBusy(1)
- nothing()
- end repeat
- else
- if aTheWinner = 2 then
- set the castNum of sprite gcTRROVER to the number of cast "Player2Wins"
- updateStage()
- updateStage()
- repeat while soundBusy(1)
- nothing()
- end repeat
- else
- set the castNum of sprite gcTRROVER to the number of cast "TieGameWins"
- updateStage()
- updateStage()
- repeat while soundBusy(1)
- nothing()
- end repeat
- end if
- end if
- myDelay(120)
- set gTRWinnerFrameRelease to 1
- set the visible of sprite gcTRROVER to 0
- set the locH of sprite gcTRROVER to -10
- set the locV of sprite gcTRROVER to -10
- updateStage()
- end
-